/**
 * @author LIU YUAN
 * @date May 15, 2011 11:12:21 AM
 * @param <T>
 */
#include "StdAfx.h"
#include "ShortJmp.h"
using namespace upupc;

ShortJmp::ShortJmp(void)
	:parameter(0)
{
}


ShortJmp::~ShortJmp(void)
{
}

void
ShortJmp::setParameter(UINT mParameter)
{
	parameter = mParameter;
}

CHAR*
ShortJmp::parse(DWORD eip)
{
	PCHAR content = new CHAR[bufferSize];
	memcpy_s(content,bufferSize,&cmd,1);

	DWORD offset = parameter - (eip + bufferSize);
	memcpy_s(content+1,bufferSize-1,(CHAR*)&offset,1);
	return content;
}

DWORD
ShortJmp::size()
{
	return bufferSize;
}
